<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - ged.info - gil/pixel_iterator.hpp</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../index.html">directory</a> - <a href="index.html">gil</a> - pixel_iterator.hpp</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>ged.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2009-06-09</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">8</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">75.0 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">6</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : /*
<span class="lineNum">       2 </span>                :     Copyright 2005-2007 Adobe Systems Incorporated
<span class="lineNum">       3 </span>                :    
<span class="lineNum">       4 </span>                :     Use, modification and distribution are subject to the Boost Software License,
<span class="lineNum">       5 </span>                :     Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
<span class="lineNum">       6 </span>                :     http://www.boost.org/LICENSE_1_0.txt).
<span class="lineNum">       7 </span>                : 
<span class="lineNum">       8 </span>                :     See http://opensource.adobe.com/gil for most recent version including documentation.
<span class="lineNum">       9 </span>                : */
<span class="lineNum">      10 </span>                : 
<span class="lineNum">      11 </span>                : /*************************************************************************************************/
<span class="lineNum">      12 </span>                : 
<span class="lineNum">      13 </span>                : #ifndef GIL_PIXEL_ITERATOR_H
<span class="lineNum">      14 </span>                : #define GIL_PIXEL_ITERATOR_H
<span class="lineNum">      15 </span>                : 
<span class="lineNum">      16 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">      17 </span>                : /// \file               
<span class="lineNum">      18 </span>                : /// \brief pixel iterator support
<span class="lineNum">      19 </span>                : /// \author Lubomir Bourdev and Hailin Jin \n
<span class="lineNum">      20 </span>                : ///         Adobe Systems Incorporated
<span class="lineNum">      21 </span>                : /// \date   2005-2007 \n May 16, 2006
<span class="lineNum">      22 </span>                : ///
<span class="lineNum">      23 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">      24 </span>                : 
<span class="lineNum">      25 </span>                : #include &lt;cassert&gt;
<span class="lineNum">      26 </span>                : #include &lt;iterator&gt;
<span class="lineNum">      27 </span>                : #include &quot;gil_config.hpp&quot;
<span class="lineNum">      28 </span>                : #include &quot;gil_concept.hpp&quot;
<span class="lineNum">      29 </span>                : #include &quot;utilities.hpp&quot;
<span class="lineNum">      30 </span>                : #include &quot;pixel.hpp&quot;
<span class="lineNum">      31 </span>                : 
<span class="lineNum">      32 </span>                : namespace boost { namespace gil {
<span class="lineNum">      33 </span>                : 
<span class="lineNum">      34 </span>                : //forwarded declaration (as this file is included in step_iterator.hpp)
<span class="lineNum">      35 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">      36 </span>                : class memory_based_step_iterator;
<span class="lineNum">      37 </span>                : 
<span class="lineNum">      38 </span>                : template &lt;typename Iterator&gt; struct dynamic_x_step_type;
<span class="lineNum">      39 </span>                : 
<span class="lineNum">      40 </span>                : /// \brief metafunction predicate determining whether the given iterator is a plain one or an adaptor over another iterator.
<span class="lineNum">      41 </span>                : /// Examples of adaptors are the step iterator and the dereference iterator adaptor.
<span class="lineNum">      42 </span>                : template &lt;typename It&gt;
<span class="lineNum">      43 </span>                : struct is_iterator_adaptor : public mpl::false_{};
<span class="lineNum">      44 </span>                : 
<span class="lineNum">      45 </span>                : /// \brief returns the base iterator for a given iterator adaptor. Provide an specialization when introducing new iterator adaptors
<span class="lineNum">      46 </span>                : template &lt;typename It&gt;
<span class="lineNum">      47 </span>                : struct iterator_adaptor_get_base;
<span class="lineNum">      48 </span>                : 
<span class="lineNum">      49 </span>                : /// \brief Changes the base iterator of an iterator adaptor. Provide an specialization when introducing new iterator adaptors
<span class="lineNum">      50 </span>                : template &lt;typename It, typename NewBaseIt&gt;
<span class="lineNum">      51 </span>                : struct iterator_adaptor_rebind;
<span class="lineNum">      52 </span>                : 
<span class="lineNum">      53 </span>                : /// \brief Returns the type of an iterator just like the input iterator, except operating over immutable values
<span class="lineNum">      54 </span>                : template &lt;typename It&gt;
<span class="lineNum">      55 </span>                : struct const_iterator_type;
<span class="lineNum">      56 </span>                : 
<span class="lineNum">      57 </span>                : // The default implementation when the iterator is a C pointer is to use the standard constness semantics
<span class="lineNum">      58 </span>                : template &lt;typename T&gt; struct const_iterator_type&lt;      T*&gt; { typedef const T* type; };
<span class="lineNum">      59 </span>                : template &lt;typename T&gt; struct const_iterator_type&lt;const T*&gt; { typedef const T* type; };
<span class="lineNum">      60 </span>                : 
<span class="lineNum">      61 </span>                : /// \brief Metafunction predicate returning whether the given iterator allows for changing its values
<span class="lineNum">      62 </span>                : /// \ingroup GILIsMutable
<span class="lineNum">      63 </span>                : template &lt;typename It&gt;
<span class="lineNum">      64 </span>                : struct iterator_is_mutable{};
<span class="lineNum">      65 </span>                : 
<span class="lineNum">      66 </span>                : // The default implementation when the iterator is a C pointer is to use the standard constness semantics
<span class="lineNum">      67 </span>                : template &lt;typename T&gt; struct iterator_is_mutable&lt;      T*&gt; : public mpl::true_{};
<span class="lineNum">      68 </span>                : template &lt;typename T&gt; struct iterator_is_mutable&lt;const T*&gt; : public mpl::false_{};
<span class="lineNum">      69 </span>                : 
<span class="lineNum">      70 </span>                : /// \defgroup PixelIteratorModelInterleavedPtr C pointer to a pixel
<span class="lineNum">      71 </span>                : /// \ingroup PixelIteratorModel
<span class="lineNum">      72 </span>                : /// \brief Iterators over interleaved pixels.
<span class="lineNum">      73 </span>                : /// A C pointer to a model of PixelValueConcept is used as an iterator over interleaved pixels. Models PixelIteratorConcept, HomogeneousPixelBasedConcept, HasDynamicXStepTypeConcept, MemoryBasedIteratorConcept
<span class="lineNum">      74 </span>                : 
<span class="lineNum">      75 </span>                : 
<span class="lineNum">      76 </span>                : 
<span class="lineNum">      77 </span>                : /////////////////////////////
<span class="lineNum">      78 </span>                : //  HasDynamicXStepTypeConcept
<span class="lineNum">      79 </span>                : /////////////////////////////
<span class="lineNum">      80 </span>                : 
<span class="lineNum">      81 </span>                : /// \ingroup PixelIteratorModelInterleavedPtr 
<span class="lineNum">      82 </span>                : template &lt;typename Pixel&gt;
<span class="lineNum">      83 </span>                : struct dynamic_x_step_type&lt;Pixel*&gt; {
<span class="lineNum">      84 </span>                :     typedef memory_based_step_iterator&lt;Pixel*&gt; type;
<span class="lineNum">      85 </span>                : };
<span class="lineNum">      86 </span>                : 
<span class="lineNum">      87 </span>                : /// \ingroup PixelIteratorModelInterleavedPtr 
<span class="lineNum">      88 </span>                : template &lt;typename Pixel&gt;
<span class="lineNum">      89 </span>                : struct dynamic_x_step_type&lt;const Pixel*&gt; {
<span class="lineNum">      90 </span>                :     typedef memory_based_step_iterator&lt;const Pixel*&gt; type;
<span class="lineNum">      91 </span>                : };
<span class="lineNum">      92 </span>                : 
<span class="lineNum">      93 </span>                : 
<span class="lineNum">      94 </span>                : /////////////////////////////
<span class="lineNum">      95 </span>                : //  PixelBasedConcept
<span class="lineNum">      96 </span>                : /////////////////////////////
<span class="lineNum">      97 </span>                : 
<span class="lineNum">      98 </span>                : template &lt;typename Pixel&gt; struct color_space_type&lt;      Pixel*&gt; : public color_space_type&lt;Pixel&gt; {};
<span class="lineNum">      99 </span>                : template &lt;typename Pixel&gt; struct color_space_type&lt;const Pixel*&gt; : public color_space_type&lt;Pixel&gt; {};
<span class="lineNum">     100 </span>                : 
<span class="lineNum">     101 </span>                : template &lt;typename Pixel&gt; struct channel_mapping_type&lt;      Pixel*&gt; : public channel_mapping_type&lt;Pixel&gt; {};
<span class="lineNum">     102 </span>                : template &lt;typename Pixel&gt; struct channel_mapping_type&lt;const Pixel*&gt; : public channel_mapping_type&lt;Pixel&gt; {};
<span class="lineNum">     103 </span>                : 
<span class="lineNum">     104 </span>                : template &lt;typename Pixel&gt; struct is_planar&lt;      Pixel*&gt; : public is_planar&lt;Pixel&gt; {};
<span class="lineNum">     105 </span>                : template &lt;typename Pixel&gt; struct is_planar&lt;const Pixel*&gt; : public is_planar&lt;Pixel&gt; {};
<span class="lineNum">     106 </span>                : 
<span class="lineNum">     107 </span>                : /////////////////////////////
<span class="lineNum">     108 </span>                : //  HomogeneousPixelBasedConcept
<span class="lineNum">     109 </span>                : /////////////////////////////
<span class="lineNum">     110 </span>                : 
<span class="lineNum">     111 </span>                : template &lt;typename Pixel&gt; struct channel_type&lt;Pixel*&gt; : public channel_type&lt;Pixel&gt; {};
<span class="lineNum">     112 </span>                : template &lt;typename Pixel&gt; struct channel_type&lt;const Pixel*&gt; : public channel_type&lt;Pixel&gt; {};
<span class="lineNum">     113 </span>                : 
<span class="lineNum">     114 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">     115 </span>                : ///
<span class="lineNum">     116 </span>                : /// Support for pixel iterator movement measured in memory units (bytes or bits) as opposed to pixel type. \n
<span class="lineNum">     117 </span>                : /// Necessary to handle image row alignment and channel plane alignment.
<span class="lineNum">     118 </span>                : ///
<span class="lineNum">     119 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">     120 </span>                : 
<span class="lineNum">     121 </span>                : /////////////////////////////
<span class="lineNum">     122 </span>                : //  MemoryBasedIteratorConcept
<span class="lineNum">     123 </span>                : /////////////////////////////
<span class="lineNum">     124 </span>                : 
<span class="lineNum">     125 </span>                : template &lt;typename T&gt;
<span class="lineNum">     126 </span>                : struct byte_to_memunit : public mpl::int_&lt;1&gt; {};
<span class="lineNum">     127 </span>                : 
<span class="lineNum">     128 </span>                : template &lt;typename P&gt;
<span class="lineNum">     129 </span><span class="lineCov">            640 : inline std::ptrdiff_t memunit_step(const P*) { return sizeof(P); }</span>
<span class="lineNum">     130 </span>                : 
<span class="lineNum">     131 </span>                : template &lt;typename P&gt;
<span class="lineNum">     132 </span>                : inline std::ptrdiff_t memunit_distance(const P* p1, const P* p2) { 
<span class="lineNum">     133 </span>                :     return (gil_reinterpret_cast_c&lt;const unsigned char*&gt;(p2)-gil_reinterpret_cast_c&lt;const unsigned char*&gt;(p1)); 
<span class="lineNum">     134 </span>                : }
<span class="lineNum">     135 </span>                : 
<span class="lineNum">     136 </span>                : template &lt;typename P&gt;
<span class="lineNum">     137 </span><span class="lineCov">             44 : inline void memunit_advance(P* &amp;p, std::ptrdiff_t diff) { </span>
<span class="lineNum">     138 </span><span class="lineCov">             44 :     p=(P*)((unsigned char*)(p)+diff);</span>
<span class="lineNum">     139 </span><span class="lineCov">             44 : }</span>
<span class="lineNum">     140 </span>                : 
<span class="lineNum">     141 </span>                : template &lt;typename P&gt;
<span class="lineNum">     142 </span><span class="lineCov">            516 : inline P* memunit_advanced(const P* p, std::ptrdiff_t diff) {</span>
<span class="lineNum">     143 </span><span class="lineCov">            516 :     return (P*)((char*)(p)+diff);</span>
<span class="lineNum">     144 </span>                : }
<span class="lineNum">     145 </span>                : 
<span class="lineNum">     146 </span>                : //  memunit_advanced_ref
<span class="lineNum">     147 </span>                : //  (shortcut to advancing a pointer by a given number of memunits and taking the reference in case the compiler is not smart enough)
<span class="lineNum">     148 </span>                : 
<span class="lineNum">     149 </span>                : template &lt;typename P&gt;
<span class="lineNum">     150 </span><span class="lineNoCov">              0 : inline P&amp; memunit_advanced_ref(P* p, std::ptrdiff_t diff) {</span>
<span class="lineNum">     151 </span><span class="lineNoCov">              0 :     return *memunit_advanced(p,diff);</span>
<span class="lineNum">     152 </span>                : }
<span class="lineNum">     153 </span>                : 
<span class="lineNum">     154 </span>                : } }  // namespace boost::gil
<span class="lineNum">     155 </span>                : 
<span class="lineNum">     156 </span>                : #endif
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
